{
  "info": {
    "_postman_id": "0837cf69-59c9-408b-8121-1247a2af5579",
    "name": "Протокол 1.4 Запись на медицинские услуги",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "48020210",
    "_collection_link": "https://go.postman.co/collection/48020210-0837cf69-59c9-408b-8121-1247a2af5579?source=collection_link"
  },
  "item": [
    {
      "name": "Предварительные условия",
      "item": [
        {
          "name": "Достать врача и организацию из токена врача и добавить в переменную",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                  "console.log(jwt);\r",
                  "if (jwt) {\r",
                  "    let payload = jwt.split('.')[1];\r",
                  "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                  "    while (payload.length % 4) payload += '=';\r",
                  "    let decoded = JSON.parse(atob(payload));\r",
                  "    console.log(decoded)\r",
                  "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                  "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                  "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                  "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                  "} else {\r",
                  "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                  "}"
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-Fhir-By-Version",
                "value": "0.3.4934",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": ""
            },
            "url": {
              "raw": "https://postman-echo.com/get",
              "protocol": "https",
              "host": [
                "postman-echo",
                "com"
              ],
              "path": [
                "get"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Достать PractitionerRole врача (PractitionerRole)",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "var jsonData = pm.response.json();\r",
                  "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                  "\r",
                  "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                  "console.log(practitionerRole)\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}",
              "protocol": "{{Schema}}",
              "host": [
                "{{Proxy-host}}"
              ],
              "path": [
                "fhir",
                "PractitionerRole"
              ],
              "query": [
                {
                  "key": "practitioner",
                  "value": "{{PractitionerId}}"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Достать структурное подразделение врача (LocationId)",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "let json = pm.response.json();\r",
                  "let locationValue = null;\r",
                  "\r",
                  "if (Array.isArray(json.entry)) {\r",
                  "    for (let entry of json.entry) {\r",
                  "        if (\r",
                  "            entry.resource &&\r",
                  "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                  "            Array.isArray(entry.resource.location) &&\r",
                  "            entry.resource.location.length > 0\r",
                  "        ) {\r",
                  "            // Берём reference первого location и извлекаем только UUID\r",
                  "            let ref = entry.resource.location[0].reference;\r",
                  "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                  "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                  "            }\r",
                  "            break;\r",
                  "        }\r",
                  "    }\r",
                  "}\r",
                  "\r",
                  "if (locationValue) {\r",
                  "    pm.environment.set(\"LocationId\", locationValue);\r",
                  "    console.log(\"location сохранён:\", locationValue);\r",
                  "} else {\r",
                  "    console.log(\"location не найден\");\r",
                  "}\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
              "protocol": "{{Schema}}",
              "host": [
                "{{Proxy-host}}"
              ],
              "path": [
                "fhir",
                "PractitionerRole"
              ],
              "query": [
                {
                  "key": "_id",
                  "value": "{{PractitionerRole}}"
                }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Вызов врача на дом из МИС",
      "item": [
        {
          "name": "1. Медицинский работник УЗ \"А\" оформляет активный визит врача общей практики УЗ \"В\" к пациенту, после выписки из стационара (УЗ \"А\")",
          "item": [
            {
              "name": "1.1 Медицинский работник УЗ \"А\" создает и импортирует в ЦИСЗ ресурс \"Вызов врача на дом\"",
              "item": [
                {
                  "name": "Предварительные условия - авторизация медицинского работника, оформившего заявку",
                  "item": [
                    {
                      "name": "Достать врача и организацию из токена врача и добавить в переменную",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                              "console.log(jwt);\r",
                              "if (jwt) {\r",
                              "    let payload = jwt.split('.')[1];\r",
                              "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                              "    while (payload.length % 4) payload += '=';\r",
                              "    let decoded = JSON.parse(atob(payload));\r",
                              "    console.log(decoded)\r",
                              "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                              "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                              "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                              "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                              "} else {\r",
                              "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                              "}"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "protocolProfileBehavior": {
                        "disableBodyPruning": true
                      },
                      "request": {
                        "method": "GET",
                        "header": [
                          {
                            "key": "X-Fhir-By-Version",
                            "value": "0.3.4934",
                            "type": "text"
                          }
                        ],
                        "body": {
                          "mode": "raw",
                          "raw": ""
                        },
                        "url": {
                          "raw": "https://postman-echo.com/get",
                          "protocol": "https",
                          "host": [
                            "postman-echo",
                            "com"
                          ],
                          "path": [
                            "get"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать PractitionerRole врача (PractitionerRole)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "var jsonData = pm.response.json();\r",
                              "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                              "\r",
                              "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                              "console.log(practitionerRole)\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "practitioner",
                              "value": "{{PractitionerId}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать структурное подразделение врача (LocationId)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "let json = pm.response.json();\r",
                              "let locationValue = null;\r",
                              "\r",
                              "if (Array.isArray(json.entry)) {\r",
                              "    for (let entry of json.entry) {\r",
                              "        if (\r",
                              "            entry.resource &&\r",
                              "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                              "            Array.isArray(entry.resource.location) &&\r",
                              "            entry.resource.location.length > 0\r",
                              "        ) {\r",
                              "            // Берём reference первого location и извлекаем только UUID\r",
                              "            let ref = entry.resource.location[0].reference;\r",
                              "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                              "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                              "            }\r",
                              "            break;\r",
                              "        }\r",
                              "    }\r",
                              "}\r",
                              "\r",
                              "if (locationValue) {\r",
                              "    pm.environment.set(\"LocationId\", locationValue);\r",
                              "    console.log(\"location сохранён:\", locationValue);\r",
                              "} else {\r",
                              "    console.log(\"location не найден\");\r",
                              "}\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "_id",
                              "value": "{{PractitionerRole}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Поиск пациента по идентификатору (patientId)",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"patientId\", patientId);\r",
                          "console.log(patientId)\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient"
                      ],
                      "query": [
                        {
                          "key": "identifier:of-type",
                          "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                        }
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод импорта пакета медицинской информации - вызов врача на дом",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                          "    pm.response.to.have.status(202);\r",
                          "});\r",
                          "\r",
                          "var jsonData = pm.response.json();\r",
                          "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                          "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                          "\r",
                          "console.log(statusReference.valueReference.reference);\r",
                          "\r",
                          "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                          "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-Fhir-By-Version",
                        "value": "active",
                        "type": "text"
                      }
                    ],
                    "body": {
                      "mode": "raw",
                      "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument\"\r\n        ]\r\n    },\r\n    \"identifier\": {\r\n        \"system\": \"urn:ietf:rfc:3986\",\r\n        \"value\": \"{{$guid}}\"\r\n    },\r\n    \"type\": \"document\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Composition/CompositionTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Composition\",\r\n                \"id\": \"CompositionServiserequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/CompDocument\"\r\n                    ]\r\n                },\r\n                \"status\": \"final\",\r\n                \"type\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/CompositionType\",\r\n                            \"code\": \"general\",\r\n                            \"display\": \"Общая медицинская информация\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"date\": \"2026-03-09\",\r\n                \"author\": [\r\n                    {\r\n                        \"reference\": \"Practitioner/{{PractitionerId}}\"\r\n                    }\r\n                ],\r\n                \"title\": \"CompDocument\",\r\n                \"custodian\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Patient/PatientTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Patient\",\r\n                \"id\": \"PatientTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/PatientWithoutIdentificationNumber\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PatientBirthDateTime\",\r\n                        \"valueDateTime\": \"2020-05-15T20:12:00Z\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"use\": \"temp\",\r\n                        \"type\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/PersonalDocumentType\",\r\n                                    \"version\": \"1.322\",\r\n                                    \"code\": \"MCN\",\r\n                                    \"display\": \"Военный билет\"\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"value\": \"990330048\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\",\r\n                            \"display\": \"Открытое акционерное общество \\\"Агентство сервисизации и реинжиниринга\\\"\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"name\": [\r\n                    {\r\n                        \"family\": \"Федотов\",\r\n                        \"given\": [\r\n                            \"Марк\",\r\n                            \"Григорьевич\"\r\n                        ]\r\n                    }\r\n                ],\r\n                \"telecom\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"phone\",\r\n                        \"value\": \"+375295437513\"\r\n                    },\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"email\",\r\n                        \"value\": \"bychkovaa.dii+500@gmail.com\"\r\n                    }\r\n                ],\r\n                \"gender\": \"male\",\r\n                \"birthDate\": \"2020-05-15\",\r\n                \"deceasedBoolean\": false,\r\n                \"address\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/CoutryForAddresses\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/CitizenshipCode\",\r\n                                            \"version\": \"1.91\",\r\n                                            \"code\": \"BY\",\r\n                                            \"display\": \"Беларусь\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/StreetGeoRegistry\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/StreetGeoRegistry\",\r\n                                            \"version\": \"1.109\",\r\n                                            \"code\": \"72609920778\",\r\n                                            \"display\": \"Переулок Снежный\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/ApartmentRoom\",\r\n                                \"valueString\": \"кв. 11\"\r\n                            }\r\n                        ],\r\n                        \"use\": \"temp\",\r\n                        \"text\": \"Могилевская область, г. Могилев, Переулок Снежный\",\r\n                        \"line\": [\r\n                            \"Переулок Снежный\"\r\n                        ],\r\n                        \"city\": \"г. Могилев\",\r\n                        \"state\": \"Могилевская область\",\r\n                        \"country\": \"Беларусь\"\r\n                    }\r\n                ],\r\n                \"multipleBirthInteger\": 2\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"ServiceRequest/ExampleServiceRequestHomeVisit\",\r\n            \"resource\": {\r\n                \"resourceType\": \"ServiceRequest\",\r\n                \"id\": \"ExampleServiceRequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ServiceRequestHomeVisit\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PlaceForHomeVisit\",\r\n                        \"valueAddress\": {\r\n                            \"text\": \"ул. Лучшая, д 21, кв 15, 2 подъезд, 4 этаж, код домофона #1354\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SpecialtyCode\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                    \"code\": \"C051\",\r\n                                    \"display\": \"Терапия и общая врачебная практика\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/RequestFromOrganization\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/HeadOfUnit\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/ContactTelecom\",\r\n                        \"valueString\": \"375447556655\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"value\": \"152\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"status\": \"active\",\r\n                \"intent\": \"directive\",\r\n                \"category\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для взрослого населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": \"routine\",\r\n                \"code\": {\r\n                    \"concept\": {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/VSHealthcareServiceTypeHomeVisit\",\r\n                                \"code\": \"B01-023-001-home.vs\",\r\n                                \"display\": \"(На дому) Прием (осмотр, консультация) врача общей практики первичный\"\r\n                            }\r\n                        ]\r\n                    }\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"occurrenceDateTime\": \"2026-03-20T12:00:00Z\",\r\n                \"authoredOn\": \"2026-03-19T12:00:00Z\",\r\n                \"requester\": {\r\n                    \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                },\r\n                \"performer\": [\r\n                    {\r\n                        \"reference\": \"Organization/{{OrganizationId}}\"\r\n                    }\r\n                ],\r\n                \"reason\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"text\": \"Выписка пациента из стационара\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"note\": [\r\n                    {\r\n                        \"text\": \"test\"\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ]\r\n}",
                      "options": {
                        "raw": {
                          "language": "json"
                        }
                      }
                    },
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "$import"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод получения статуса импорта пакета медицинской информации",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "{{bundleId}}",
                        "$status"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "1.2 Медицинский работник (регистратор) УЗ \"В\" получает все заявки на вызов врача на дом",
              "item": [
                {
                  "name": "Предварительные условия - авторизация медицинского работника, получившего все заявки",
                  "item": [
                    {
                      "name": "Достать врача и организацию из токена врача и добавить в переменную",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                              "console.log(jwt);\r",
                              "if (jwt) {\r",
                              "    let payload = jwt.split('.')[1];\r",
                              "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                              "    while (payload.length % 4) payload += '=';\r",
                              "    let decoded = JSON.parse(atob(payload));\r",
                              "    console.log(decoded)\r",
                              "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                              "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                              "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                              "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                              "} else {\r",
                              "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                              "}"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "protocolProfileBehavior": {
                        "disableBodyPruning": true
                      },
                      "request": {
                        "method": "GET",
                        "header": [
                          {
                            "key": "X-Fhir-By-Version",
                            "value": "0.3.4934",
                            "type": "text"
                          }
                        ],
                        "body": {
                          "mode": "raw",
                          "raw": ""
                        },
                        "url": {
                          "raw": "https://postman-echo.com/get",
                          "protocol": "https",
                          "host": [
                            "postman-echo",
                            "com"
                          ],
                          "path": [
                            "get"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать PractitionerRole врача (PractitionerRole)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "var jsonData = pm.response.json();\r",
                              "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                              "\r",
                              "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                              "console.log(practitionerRole)\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "practitioner",
                              "value": "{{PractitionerId}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать структурное подразделение врача (LocationId)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "let json = pm.response.json();\r",
                              "let locationValue = null;\r",
                              "\r",
                              "if (Array.isArray(json.entry)) {\r",
                              "    for (let entry of json.entry) {\r",
                              "        if (\r",
                              "            entry.resource &&\r",
                              "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                              "            Array.isArray(entry.resource.location) &&\r",
                              "            entry.resource.location.length > 0\r",
                              "        ) {\r",
                              "            // Берём reference первого location и извлекаем только UUID\r",
                              "            let ref = entry.resource.location[0].reference;\r",
                              "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                              "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                              "            }\r",
                              "            break;\r",
                              "        }\r",
                              "    }\r",
                              "}\r",
                              "\r",
                              "if (locationValue) {\r",
                              "    pm.environment.set(\"LocationId\", locationValue);\r",
                              "    console.log(\"location сохранён:\", locationValue);\r",
                              "} else {\r",
                              "    console.log(\"location не найден\");\r",
                              "}\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "_id",
                              "value": "{{PractitionerRole}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Метод проверки наличия запроса на получение Заявки на вызов врача на дом в контексте Пациента",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/ServiceRequestBy?_profile=https://fhir.by/StructureDefinition/ServiceRequestHomeVisit&_sort=-_lastUpdated&status=active",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Organization",
                        "{{OrganizationId}}",
                        "ServiceRequestBy"
                      ],
                      "query": [
                        {
                          "key": "_profile",
                          "value": "https://fhir.by/StructureDefinition/ServiceRequestHomeVisit"
                        },
                        {
                          "key": "_sort",
                          "value": "-_lastUpdated"
                        },
                        {
                          "key": "status",
                          "value": "active"
                        }
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "1.3 Медицинский работник УЗ \"B\" создает и импортирует в ЦИСЗ результаты визита к пациенту",
              "item": [
                {
                  "name": "Предварительные условия - авторизация медицинского работника, оформившего заявку",
                  "item": [
                    {
                      "name": "Достать врача и организацию из токена врача и добавить в переменную",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                              "console.log(jwt);\r",
                              "if (jwt) {\r",
                              "    let payload = jwt.split('.')[1];\r",
                              "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                              "    while (payload.length % 4) payload += '=';\r",
                              "    let decoded = JSON.parse(atob(payload));\r",
                              "    console.log(decoded)\r",
                              "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                              "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                              "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                              "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                              "} else {\r",
                              "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                              "}"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "protocolProfileBehavior": {
                        "disableBodyPruning": true
                      },
                      "request": {
                        "method": "GET",
                        "header": [
                          {
                            "key": "X-Fhir-By-Version",
                            "value": "0.3.4934",
                            "type": "text"
                          }
                        ],
                        "body": {
                          "mode": "raw",
                          "raw": ""
                        },
                        "url": {
                          "raw": "https://postman-echo.com/get",
                          "protocol": "https",
                          "host": [
                            "postman-echo",
                            "com"
                          ],
                          "path": [
                            "get"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать PractitionerRole врача (PractitionerRole)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "var jsonData = pm.response.json();\r",
                              "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                              "\r",
                              "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                              "console.log(practitionerRole)\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "practitioner",
                              "value": "{{PractitionerId}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать структурное подразделение врача (LocationId)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "let json = pm.response.json();\r",
                              "let locationValue = null;\r",
                              "\r",
                              "if (Array.isArray(json.entry)) {\r",
                              "    for (let entry of json.entry) {\r",
                              "        if (\r",
                              "            entry.resource &&\r",
                              "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                              "            Array.isArray(entry.resource.location) &&\r",
                              "            entry.resource.location.length > 0\r",
                              "        ) {\r",
                              "            // Берём reference первого location и извлекаем только UUID\r",
                              "            let ref = entry.resource.location[0].reference;\r",
                              "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                              "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                              "            }\r",
                              "            break;\r",
                              "        }\r",
                              "    }\r",
                              "}\r",
                              "\r",
                              "if (locationValue) {\r",
                              "    pm.environment.set(\"LocationId\", locationValue);\r",
                              "    console.log(\"location сохранён:\", locationValue);\r",
                              "} else {\r",
                              "    console.log(\"location не найден\");\r",
                              "}\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "_id",
                              "value": "{{PractitionerRole}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Поиск пациента по идентификатору (patientId)",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"patientId\", patientId);\r",
                          "console.log(patientId)\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient"
                      ],
                      "query": [
                        {
                          "key": "identifier:of-type",
                          "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                        }
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод получения вызова врача на дом в контексте пациента",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let serviceRequestId = jsonData.entry.find(obj => obj.resource.resourceType === \"ServiceRequest\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"serviceRequestId\", serviceRequestId);\r",
                          "console.log(serviceRequestId)"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/ServiceRequest?_profile=https://fhir.by/StructureDefinition/ServiceRequestHomeVisit&status=active&_sort=-_lastUpdated",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient",
                        "{{patientId}}",
                        "ServiceRequest"
                      ],
                      "query": [
                        {
                          "key": "_profile",
                          "value": "https://fhir.by/StructureDefinition/ServiceRequestHomeVisit"
                        },
                        {
                          "key": "status",
                          "value": "active"
                        },
                        {
                          "key": "_sort",
                          "value": "-_lastUpdated"
                        }
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод импорта пакета медицинской информации - вызов врача на дом",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                          "    pm.response.to.have.status(202);\r",
                          "});\r",
                          "\r",
                          "var jsonData = pm.response.json();\r",
                          "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                          "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                          "\r",
                          "console.log(statusReference.valueReference.reference);\r",
                          "\r",
                          "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                          "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-Fhir-By-Version",
                        "value": "active",
                        "type": "text"
                      }
                    ],
                    "body": {
                      "mode": "raw",
                      "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument\"\r\n        ]\r\n    },\r\n    \"identifier\": {\r\n        \"system\": \"urn:ietf:rfc:3986\",\r\n        \"value\": \"{{$guid}}\"\r\n    },\r\n    \"type\": \"document\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Composition/CompositionTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Composition\",\r\n                \"id\": \"CompositionServiserequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/CompDocument\"\r\n                    ]\r\n                },\r\n                \"status\": \"final\",\r\n                \"type\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/CompositionType\",\r\n                            \"code\": \"general\",\r\n                            \"display\": \"Общая медицинская информация\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"date\": \"2026-03-09\",\r\n                \"author\": [\r\n                    {\r\n                        \"reference\": \"Practitioner/{{PractitionerId}}\"\r\n                    }\r\n                ],\r\n                \"title\": \"CompDocument\",\r\n                \"custodian\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Patient/PatientTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Patient\",\r\n                \"id\": \"PatientTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/PatientWithoutIdentificationNumber\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PatientBirthDateTime\",\r\n                        \"valueDateTime\": \"2020-05-15T20:12:00Z\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"use\": \"temp\",\r\n                        \"type\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/PersonalDocumentType\",\r\n                                    \"version\": \"1.322\",\r\n                                    \"code\": \"MCN\",\r\n                                    \"display\": \"Военный билет\"\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"value\": \"990330048\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\",\r\n                            \"display\": \"Открытое акционерное общество \\\"Агентство сервисизации и реинжиниринга\\\"\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"name\": [\r\n                    {\r\n                        \"family\": \"Федотов\",\r\n                        \"given\": [\r\n                            \"Марк\",\r\n                            \"Григорьевич\"\r\n                        ]\r\n                    }\r\n                ],\r\n                \"telecom\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"phone\",\r\n                        \"value\": \"+375295437513\"\r\n                    },\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"email\",\r\n                        \"value\": \"bychkovaa.dii+500@gmail.com\"\r\n                    }\r\n                ],\r\n                \"gender\": \"male\",\r\n                \"birthDate\": \"2020-05-15\",\r\n                \"deceasedBoolean\": false,\r\n                \"address\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/CoutryForAddresses\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/CitizenshipCode\",\r\n                                            \"version\": \"1.91\",\r\n                                            \"code\": \"BY\",\r\n                                            \"display\": \"Беларусь\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/StreetGeoRegistry\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/StreetGeoRegistry\",\r\n                                            \"version\": \"1.109\",\r\n                                            \"code\": \"72609920778\",\r\n                                            \"display\": \"Переулок Снежный\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/ApartmentRoom\",\r\n                                \"valueString\": \"кв. 11\"\r\n                            }\r\n                        ],\r\n                        \"use\": \"temp\",\r\n                        \"text\": \"Могилевская область, г. Могилев, Переулок Снежный\",\r\n                        \"line\": [\r\n                            \"Переулок Снежный\"\r\n                        ],\r\n                        \"city\": \"г. Могилев\",\r\n                        \"state\": \"Могилевская область\",\r\n                        \"country\": \"Беларусь\"\r\n                    }\r\n                ],\r\n                \"multipleBirthInteger\": 2\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Encounter/ExampleEncounterRequestHomeVisit\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Encounter\",\r\n                \"id\": \"ExampleEncounterRequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/EncounterGeneral\"\r\n                    ]\r\n                },\r\n                \"status\": \"completed\",\r\n                \"class\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/VSTermsOfService\",\r\n                                \"code\": \"5\",\r\n                                \"display\": \"на дому\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/HealthCareForms\",\r\n                            \"code\": \"planned\",\r\n                            \"display\": \"Плановая медицинская помощь\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"type\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/TypeOfHealthCare\",\r\n                                \"code\": \"primary\",\r\n                                \"display\": \"Первичная медицинская помощь\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"basedOn\": [\r\n                    {\r\n                    \"reference\": \"ServiceRequest/{{serviceRequestId}}\"\r\n                    }\r\n                ],\r\n                \"serviceProvider\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                },\r\n                \"participant\": [\r\n                    {\r\n                        \"actor\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"actualPeriod\": {\r\n                    \"start\": \"2026-03-20T11:12:21Z\",\r\n                    \"end\": \"2026-03-20T11:25:21Z\"\r\n                },\r\n                \"diagnosis\": [\r\n                    {\r\n                        \"condition\": [\r\n                            {\r\n                                \"reference\": {\r\n                                    \"reference\": \"Condition/ExampleConditionRequestHomeVisit\"\r\n                                }\r\n                            }\r\n                        ],\r\n                        \"use\": [\r\n                            {\r\n                                \"coding\": [\r\n                                    {\r\n                                        \"system\": \"https://fhir.by/ValueSet/TypeOfDiagnosis\",\r\n                                        \"code\": \"mainDiagnosis\"\r\n                                    }\r\n                                ]\r\n                            }\r\n                        ]\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Condition/ExampleConditionRequestHomeVisit\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Condition\",\r\n                \"id\": \"ExampleConditionRequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/FinalDiagnosis\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/KindOfDiagnosis\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/KindOfDiagnosisCode\",\r\n                                    \"code\": \"Final\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/AssertedDate\",\r\n                        \"valueDateTime\": \"2024-08-08\"\r\n                    }\r\n                ],\r\n                \"clinicalStatus\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\r\n                            \"code\": \"active\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"code\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/InternClassificDiseases10\",\r\n                            \"code\": \"I11.9\",\r\n                            \"display\": \"I11.9 - Гипертензивная [гипертоническая] болезнь с преимущественным поражением сердца без (застойной) сердечной недостаточности\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"onsetDateTime\": \"2026-03-20\",\r\n                \"recordedDate\": \"2026-03-20\"\r\n            }\r\n        }\r\n    ]\r\n}",
                      "options": {
                        "raw": {
                          "language": "json"
                        }
                      }
                    },
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "$import"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод получения статуса импорта пакета медицинской информации",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "{{bundleId}}",
                        "$status"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Получения выполненного вызова врача на дом",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let serviceRequestId = jsonData.entry.find(obj => obj.resource.resourceType === \"ServiceRequest\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"serviceRequestId\", serviceRequestId);\r",
                          "console.log(serviceRequestId)"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/ServiceRequest/{{serviceRequestId}}",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient",
                        "{{patientId}}",
                        "ServiceRequest",
                        "{{serviceRequestId}}"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            }
          ],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "packages": {},
                "requests": {},
                "exec": [
                  ""
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "packages": {},
                "requests": {},
                "exec": [
                  ""
                ]
              }
            }
          ]
        },
        {
          "name": "2. Отмена активного визита медицинским работником УЗ \"В\", который был создан медицинским работником УЗ \"А\"",
          "item": [
            {
              "name": "1.1 Медицинский работник УЗ \"А\" создает и импортирует в ЦИСЗ ресурс \"Вызов врача на дом\"",
              "item": [
                {
                  "name": "Предварительные условия - авторизация медицинского работника, оформившего заявку",
                  "item": [
                    {
                      "name": "Достать врача и организацию из токена врача и добавить в переменную",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                              "console.log(jwt);\r",
                              "if (jwt) {\r",
                              "    let payload = jwt.split('.')[1];\r",
                              "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                              "    while (payload.length % 4) payload += '=';\r",
                              "    let decoded = JSON.parse(atob(payload));\r",
                              "    console.log(decoded)\r",
                              "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                              "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                              "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                              "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                              "} else {\r",
                              "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                              "}"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "protocolProfileBehavior": {
                        "disableBodyPruning": true
                      },
                      "request": {
                        "method": "GET",
                        "header": [
                          {
                            "key": "X-Fhir-By-Version",
                            "value": "0.3.4934",
                            "type": "text"
                          }
                        ],
                        "body": {
                          "mode": "raw",
                          "raw": ""
                        },
                        "url": {
                          "raw": "https://postman-echo.com/get",
                          "protocol": "https",
                          "host": [
                            "postman-echo",
                            "com"
                          ],
                          "path": [
                            "get"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать PractitionerRole врача (PractitionerRole)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "var jsonData = pm.response.json();\r",
                              "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                              "\r",
                              "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                              "console.log(practitionerRole)\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "practitioner",
                              "value": "{{PractitionerId}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать структурное подразделение врача (LocationId)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "let json = pm.response.json();\r",
                              "let locationValue = null;\r",
                              "\r",
                              "if (Array.isArray(json.entry)) {\r",
                              "    for (let entry of json.entry) {\r",
                              "        if (\r",
                              "            entry.resource &&\r",
                              "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                              "            Array.isArray(entry.resource.location) &&\r",
                              "            entry.resource.location.length > 0\r",
                              "        ) {\r",
                              "            // Берём reference первого location и извлекаем только UUID\r",
                              "            let ref = entry.resource.location[0].reference;\r",
                              "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                              "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                              "            }\r",
                              "            break;\r",
                              "        }\r",
                              "    }\r",
                              "}\r",
                              "\r",
                              "if (locationValue) {\r",
                              "    pm.environment.set(\"LocationId\", locationValue);\r",
                              "    console.log(\"location сохранён:\", locationValue);\r",
                              "} else {\r",
                              "    console.log(\"location не найден\");\r",
                              "}\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "_id",
                              "value": "{{PractitionerRole}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Поиск пациента по идентификатору (patientId)",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"patientId\", patientId);\r",
                          "console.log(patientId)\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient"
                      ],
                      "query": [
                        {
                          "key": "identifier:of-type",
                          "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                        }
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод импорта пакета медицинской информации - вызов врача на дом",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                          "    pm.response.to.have.status(202);\r",
                          "});\r",
                          "\r",
                          "var jsonData = pm.response.json();\r",
                          "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                          "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                          "\r",
                          "console.log(statusReference.valueReference.reference);\r",
                          "\r",
                          "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                          "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-Fhir-By-Version",
                        "value": "active",
                        "type": "text"
                      }
                    ],
                    "body": {
                      "mode": "raw",
                      "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument\"\r\n        ]\r\n    },\r\n    \"identifier\": {\r\n        \"system\": \"urn:ietf:rfc:3986\",\r\n        \"value\": \"{{$guid}}\"\r\n    },\r\n    \"type\": \"document\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Composition/CompositionTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Composition\",\r\n                \"id\": \"CompositionServiserequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/CompDocument\"\r\n                    ]\r\n                },\r\n                \"status\": \"final\",\r\n                \"type\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/CompositionType\",\r\n                            \"code\": \"general\",\r\n                            \"display\": \"Общая медицинская информация\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"date\": \"2026-03-09\",\r\n                \"author\": [\r\n                    {\r\n                        \"reference\": \"Practitioner/{{PractitionerId}}\"\r\n                    }\r\n                ],\r\n                \"title\": \"CompDocument\",\r\n                \"custodian\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Patient/PatientTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Patient\",\r\n                \"id\": \"PatientTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/PatientWithoutIdentificationNumber\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PatientBirthDateTime\",\r\n                        \"valueDateTime\": \"2020-05-15T20:12:00Z\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"use\": \"temp\",\r\n                        \"type\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/PersonalDocumentType\",\r\n                                    \"version\": \"1.322\",\r\n                                    \"code\": \"MCN\",\r\n                                    \"display\": \"Военный билет\"\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"value\": \"990330048\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\",\r\n                            \"display\": \"Открытое акционерное общество \\\"Агентство сервисизации и реинжиниринга\\\"\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"name\": [\r\n                    {\r\n                        \"family\": \"Федотов\",\r\n                        \"given\": [\r\n                            \"Марк\",\r\n                            \"Григорьевич\"\r\n                        ]\r\n                    }\r\n                ],\r\n                \"telecom\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"phone\",\r\n                        \"value\": \"+375295437513\"\r\n                    },\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"email\",\r\n                        \"value\": \"bychkovaa.dii+500@gmail.com\"\r\n                    }\r\n                ],\r\n                \"gender\": \"male\",\r\n                \"birthDate\": \"2020-05-15\",\r\n                \"deceasedBoolean\": false,\r\n                \"address\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/CoutryForAddresses\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/CitizenshipCode\",\r\n                                            \"version\": \"1.91\",\r\n                                            \"code\": \"BY\",\r\n                                            \"display\": \"Беларусь\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/StreetGeoRegistry\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/StreetGeoRegistry\",\r\n                                            \"version\": \"1.109\",\r\n                                            \"code\": \"72609920778\",\r\n                                            \"display\": \"Переулок Снежный\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/ApartmentRoom\",\r\n                                \"valueString\": \"кв. 11\"\r\n                            }\r\n                        ],\r\n                        \"use\": \"temp\",\r\n                        \"text\": \"Могилевская область, г. Могилев, Переулок Снежный\",\r\n                        \"line\": [\r\n                            \"Переулок Снежный\"\r\n                        ],\r\n                        \"city\": \"г. Могилев\",\r\n                        \"state\": \"Могилевская область\",\r\n                        \"country\": \"Беларусь\"\r\n                    }\r\n                ],\r\n                \"multipleBirthInteger\": 2\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"ServiceRequest/ExampleServiceRequestHomeVisit\",\r\n            \"resource\": {\r\n                \"resourceType\": \"ServiceRequest\",\r\n                \"id\": \"ExampleRequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ServiceRequestHomeVisit\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PlaceForHomeVisit\",\r\n                        \"valueAddress\": {\r\n                            \"text\": \"ул. Лучшая, д 21, кв 15, 2 подъезд, 4 этаж, код домофона #1354\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"status\": \"active\",\r\n                \"intent\": \"directive\",\r\n                \"category\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для взрослого населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": \"routine\",\r\n                \"code\": {\r\n                    \"concept\": {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/VSHealthcareServiceTypeHomeVisit\",\r\n                                \"code\": \"B01-023-001-home.vs\",\r\n                                \"display\": \"(На дому) Прием (осмотр, консультация) врача общей практики первичный\"\r\n                            }\r\n                        ]\r\n                    }\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"occurrenceDateTime\": \"2026-03-20T12:00:00Z\",\r\n                \"authoredOn\": \"2026-03-19T12:00:00Z\",\r\n                \"requester\": {\r\n                    \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                },\r\n                \"performer\": [\r\n                    {\r\n                        \"reference\": \"Organization/{{OrganizationId}}\"\r\n                    }\r\n                ],\r\n                \"reason\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"text\": \"Выписка пациента из стационара\"\r\n                        }\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ]\r\n}",
                      "options": {
                        "raw": {
                          "language": "json"
                        }
                      }
                    },
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "$import"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод получения статуса импорта пакета медицинской информации",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "{{bundleId}}",
                        "$status"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            },
            {
              "name": "1.2 Медицинский работник отменяет визит на дом к пациенту",
              "item": [
                {
                  "name": "Предварительные условия - авторизация медицинского работника, оформившего заявку",
                  "item": [
                    {
                      "name": "Достать врача и организацию из токена врача и добавить в переменную",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                              "console.log(jwt);\r",
                              "if (jwt) {\r",
                              "    let payload = jwt.split('.')[1];\r",
                              "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                              "    while (payload.length % 4) payload += '=';\r",
                              "    let decoded = JSON.parse(atob(payload));\r",
                              "    console.log(decoded)\r",
                              "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                              "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                              "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                              "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                              "} else {\r",
                              "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                              "}"
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "protocolProfileBehavior": {
                        "disableBodyPruning": true
                      },
                      "request": {
                        "method": "GET",
                        "header": [
                          {
                            "key": "X-Fhir-By-Version",
                            "value": "0.3.4934",
                            "type": "text"
                          }
                        ],
                        "body": {
                          "mode": "raw",
                          "raw": ""
                        },
                        "url": {
                          "raw": "https://postman-echo.com/get",
                          "protocol": "https",
                          "host": [
                            "postman-echo",
                            "com"
                          ],
                          "path": [
                            "get"
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать PractitionerRole врача (PractitionerRole)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "var jsonData = pm.response.json();\r",
                              "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                              "\r",
                              "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                              "console.log(practitionerRole)\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "practitioner",
                              "value": "{{PractitionerId}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    },
                    {
                      "name": "Достать структурное подразделение врача (LocationId)",
                      "event": [
                        {
                          "listen": "test",
                          "script": {
                            "exec": [
                              "let json = pm.response.json();\r",
                              "let locationValue = null;\r",
                              "\r",
                              "if (Array.isArray(json.entry)) {\r",
                              "    for (let entry of json.entry) {\r",
                              "        if (\r",
                              "            entry.resource &&\r",
                              "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                              "            Array.isArray(entry.resource.location) &&\r",
                              "            entry.resource.location.length > 0\r",
                              "        ) {\r",
                              "            // Берём reference первого location и извлекаем только UUID\r",
                              "            let ref = entry.resource.location[0].reference;\r",
                              "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                              "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                              "            }\r",
                              "            break;\r",
                              "        }\r",
                              "    }\r",
                              "}\r",
                              "\r",
                              "if (locationValue) {\r",
                              "    pm.environment.set(\"LocationId\", locationValue);\r",
                              "    console.log(\"location сохранён:\", locationValue);\r",
                              "} else {\r",
                              "    console.log(\"location не найден\");\r",
                              "}\r",
                              ""
                            ],
                            "type": "text/javascript",
                            "packages": {},
                            "requests": {}
                          }
                        }
                      ],
                      "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                          "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                          "protocol": "{{Schema}}",
                          "host": [
                            "{{Proxy-host}}"
                          ],
                          "path": [
                            "fhir",
                            "PractitionerRole"
                          ],
                          "query": [
                            {
                              "key": "_id",
                              "value": "{{PractitionerRole}}"
                            }
                          ]
                        }
                      },
                      "response": []
                    }
                  ]
                },
                {
                  "name": "Поиск пациента по идентификатору (patientId)",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"patientId\", patientId);\r",
                          "console.log(patientId)\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient"
                      ],
                      "query": [
                        {
                          "key": "identifier:of-type",
                          "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                        }
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод получения вызова врача на дом в контексте пациента",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let serviceRequestId = jsonData.entry.find(obj => obj.resource.resourceType === \"ServiceRequest\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"serviceRequestId\", serviceRequestId);\r",
                          "console.log(serviceRequestId)"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/ServiceRequest?_profile=https://fhir.by/StructureDefinition/ServiceRequestHomeVisit&status=active&_sort=-_lastUpdated",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Organization",
                        "{{OrganizationId}}",
                        "ServiceRequest"
                      ],
                      "query": [
                        {
                          "key": "_profile",
                          "value": "https://fhir.by/StructureDefinition/ServiceRequestHomeVisit"
                        },
                        {
                          "key": "status",
                          "value": "active"
                        },
                        {
                          "key": "_sort",
                          "value": "-_lastUpdated"
                        }
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод импорта пакета медицинской информации - вызов врача на дом",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                          "    pm.response.to.have.status(202);\r",
                          "});\r",
                          "\r",
                          "var jsonData = pm.response.json();\r",
                          "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                          "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                          "\r",
                          "console.log(statusReference.valueReference.reference);\r",
                          "\r",
                          "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                          "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);\r",
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    },
                    {
                      "listen": "prerequest",
                      "script": {
                        "exec": [
                          ""
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "POST",
                    "header": [
                      {
                        "key": "X-Fhir-By-Version",
                        "value": "active",
                        "type": "text"
                      }
                    ],
                    "body": {
                      "mode": "raw",
                      "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument\"\r\n        ]\r\n    },\r\n    \"identifier\": {\r\n        \"system\": \"urn:ietf:rfc:3986\",\r\n        \"value\": \"{{$guid}}\"\r\n    },\r\n    \"type\": \"document\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Composition/CompositionTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Composition\",\r\n                \"id\": \"CompositionServiserequestHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/CompDocument\"\r\n                    ]\r\n                },\r\n                \"status\": \"final\",\r\n                \"type\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/CompositionType\",\r\n                            \"code\": \"general\",\r\n                            \"display\": \"Общая медицинская информация\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"date\": \"2026-03-09\",\r\n                \"author\": [\r\n                    {\r\n                        \"reference\": \"Practitioner/{{PractitionerId}}\"\r\n                    }\r\n                ],\r\n                \"title\": \"CompDocument\",\r\n                \"custodian\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Patient/PatientTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Patient\",\r\n                \"id\": \"PatientTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/PatientWithoutIdentificationNumber\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PatientBirthDateTime\",\r\n                        \"valueDateTime\": \"2020-05-15T20:12:00Z\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"use\": \"temp\",\r\n                        \"type\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/PersonalDocumentType\",\r\n                                    \"version\": \"1.322\",\r\n                                    \"code\": \"MCN\",\r\n                                    \"display\": \"Военный билет\"\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"value\": \"990330048\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\",\r\n                            \"display\": \"Открытое акционерное общество \\\"Агентство сервисизации и реинжиниринга\\\"\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"name\": [\r\n                    {\r\n                        \"family\": \"Федотов\",\r\n                        \"given\": [\r\n                            \"Марк\",\r\n                            \"Григорьевич\"\r\n                        ]\r\n                    }\r\n                ],\r\n                \"telecom\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"phone\",\r\n                        \"value\": \"+375295437513\"\r\n                    },\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"email\",\r\n                        \"value\": \"bychkovaa.dii+500@gmail.com\"\r\n                    }\r\n                ],\r\n                \"gender\": \"male\",\r\n                \"birthDate\": \"2020-05-15\",\r\n                \"deceasedBoolean\": false,\r\n                \"address\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/CoutryForAddresses\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/CitizenshipCode\",\r\n                                            \"version\": \"1.91\",\r\n                                            \"code\": \"BY\",\r\n                                            \"display\": \"Беларусь\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/StreetGeoRegistry\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/StreetGeoRegistry\",\r\n                                            \"version\": \"1.109\",\r\n                                            \"code\": \"72609920778\",\r\n                                            \"display\": \"Переулок Снежный\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/ApartmentRoom\",\r\n                                \"valueString\": \"кв. 11\"\r\n                            }\r\n                        ],\r\n                        \"use\": \"temp\",\r\n                        \"text\": \"Могилевская область, г. Могилев, Переулок Снежный\",\r\n                        \"line\": [\r\n                            \"Переулок Снежный\"\r\n                        ],\r\n                        \"city\": \"г. Могилев\",\r\n                        \"state\": \"Могилевская область\",\r\n                        \"country\": \"Беларусь\"\r\n                    }\r\n                ],\r\n                \"multipleBirthInteger\": 2\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Contract/RejectionHomeVisit\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Contract\",\r\n                \"id\": \"RejectionHomeVisit\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/RejectionBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/CancellationReason\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/VSServiceRequestRejectionReasonProvider\",\r\n                                    \"code\": \"prov-sick.vs\",\r\n                                    \"display\": \"Поставщик услуг: Больничный\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"status\": \"executed\",\r\n                \"issued\": \"2026-03-20T14:00:00Z\",\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"title\": \"Отмена вызова врача на дом\",\r\n                \"author\": {\r\n                    \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                },\r\n                \"topicReference\": {\r\n                    \"reference\": \"ServiceRequest/{{serviceRequestId}}\"\r\n                }\r\n            }\r\n        }\r\n    ]\r\n}",
                      "options": {
                        "raw": {
                          "language": "json"
                        }
                      }
                    },
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "$import"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Метод получения статуса импорта пакета медицинской информации",
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Bundle",
                        "{{bundleId}}",
                        "$status"
                      ]
                    }
                  },
                  "response": []
                },
                {
                  "name": "Получения отмененного вызова врача на дом по id",
                  "event": [
                    {
                      "listen": "test",
                      "script": {
                        "exec": [
                          "var jsonData = pm.response.json();\r",
                          "let serviceRequestId = jsonData.entry.find(obj => obj.resource.resourceType === \"ServiceRequest\").resource.id;\r",
                          "\r",
                          "pm.environment.set(\"serviceRequestId\", serviceRequestId);\r",
                          "console.log(serviceRequestId)"
                        ],
                        "type": "text/javascript",
                        "packages": {},
                        "requests": {}
                      }
                    }
                  ],
                  "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                      "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/ServiceRequest/{{serviceRequestId}}",
                      "protocol": "{{Schema}}",
                      "host": [
                        "{{Proxy-host}}"
                      ],
                      "path": [
                        "fhir",
                        "Patient",
                        "{{patientId}}",
                        "ServiceRequest",
                        "{{serviceRequestId}}"
                      ]
                    }
                  },
                  "response": []
                }
              ]
            }
          ],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "packages": {},
                "requests": {},
                "exec": [
                  ""
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "packages": {},
                "requests": {},
                "exec": [
                  ""
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Формирование графика (расписания) работы врачей",
      "item": [
        {
          "name": "Предварительные условия - авторизация медицинского работника, создающего расписание",
          "item": [
            {
              "name": "Достать врача и организацию из токена врача и добавить в переменную",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                      "console.log(jwt);\r",
                      "if (jwt) {\r",
                      "    let payload = jwt.split('.')[1];\r",
                      "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                      "    while (payload.length % 4) payload += '=';\r",
                      "    let decoded = JSON.parse(atob(payload));\r",
                      "    console.log(decoded)\r",
                      "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                      "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                      "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                      "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                      "} else {\r",
                      "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                      "}"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "protocolProfileBehavior": {
                "disableBodyPruning": true
              },
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "0.3.4934",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "https://postman-echo.com/get",
                  "protocol": "https",
                  "host": [
                    "postman-echo",
                    "com"
                  ],
                  "path": [
                    "get"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Достать PractitionerRole врача (PractitionerRole)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                      "console.log(practitionerRole)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}&position-type=cardiac-surgeon",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "practitioner",
                      "value": "{{PractitionerId}}"
                    },
                    {
                      "key": "position-type",
                      "value": "cardiac-surgeon"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Достать структурное подразделение врача (LocationId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "let json = pm.response.json();\r",
                      "let locationValue = null;\r",
                      "\r",
                      "if (Array.isArray(json.entry)) {\r",
                      "    for (let entry of json.entry) {\r",
                      "        if (\r",
                      "            entry.resource &&\r",
                      "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                      "            Array.isArray(entry.resource.location) &&\r",
                      "            entry.resource.location.length > 0\r",
                      "        ) {\r",
                      "            // Берём reference первого location и извлекаем только UUID\r",
                      "            let ref = entry.resource.location[0].reference;\r",
                      "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                      "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                      "            }\r",
                      "            break;\r",
                      "        }\r",
                      "    }\r",
                      "}\r",
                      "\r",
                      "if (locationValue) {\r",
                      "    pm.environment.set(\"LocationId\", locationValue);\r",
                      "    console.log(\"location сохранён:\", locationValue);\r",
                      "} else {\r",
                      "    console.log(\"location не найден\");\r",
                      "}\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "_id",
                      "value": "{{PractitionerRole}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск PractitionerRole врача-терапевта",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let practitionerRole_therapist = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"PractitionerRole_therapist\", practitionerRole_therapist);\r",
                      "console.log(practitionerRole_therapist)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?position-type=therapist&organization={{OrganizationId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "position-type",
                      "value": "therapist"
                    },
                    {
                      "key": "organization",
                      "value": "{{OrganizationId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск Location врача-терапевта",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "let json = pm.response.json();\r",
                      "let locationValue = null;\r",
                      "\r",
                      "if (Array.isArray(json.entry)) {\r",
                      "    for (let entry of json.entry) {\r",
                      "        if (\r",
                      "            entry.resource &&\r",
                      "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                      "            Array.isArray(entry.resource.location) &&\r",
                      "            entry.resource.location.length > 0\r",
                      "        ) {\r",
                      "            // Берём reference первого location и извлекаем только UUID\r",
                      "            let ref = entry.resource.location[0].reference;\r",
                      "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                      "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                      "            }\r",
                      "            break;\r",
                      "        }\r",
                      "    }\r",
                      "}\r",
                      "\r",
                      "if (locationValue) {\r",
                      "    pm.environment.set(\"LocationId_therapist\", locationValue);\r",
                      "    console.log(\"location сохранён:\", locationValue);\r",
                      "} else {\r",
                      "    console.log(\"location не найден\");\r",
                      "}\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole_therapist}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "_id",
                      "value": "{{PractitionerRole_therapist}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск PractitionerRole врача-невролога",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let practitionerRole_neurologist = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"PractitionerRole_neurologist\", practitionerRole_neurologist);\r",
                      "console.log(practitionerRole_neurologist)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?position-type=neurologist&organization={{OrganizationId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "position-type",
                      "value": "neurologist"
                    },
                    {
                      "key": "organization",
                      "value": "{{OrganizationId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск Location врача-невролога",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "let json = pm.response.json();\r",
                      "let locationValue = null;\r",
                      "\r",
                      "if (Array.isArray(json.entry)) {\r",
                      "    for (let entry of json.entry) {\r",
                      "        if (\r",
                      "            entry.resource &&\r",
                      "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                      "            Array.isArray(entry.resource.location) &&\r",
                      "            entry.resource.location.length > 0\r",
                      "        ) {\r",
                      "            // Берём reference первого location и извлекаем только UUID\r",
                      "            let ref = entry.resource.location[0].reference;\r",
                      "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                      "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                      "            }\r",
                      "            break;\r",
                      "        }\r",
                      "    }\r",
                      "}\r",
                      "\r",
                      "if (locationValue) {\r",
                      "    pm.environment.set(\"LocationId_neurologist\", locationValue);\r",
                      "    console.log(\"location сохранён:\", locationValue);\r",
                      "} else {\r",
                      "    console.log(\"location не найден\");\r",
                      "}\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole_neurologist}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "_id",
                      "value": "{{PractitionerRole_neurologist}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "1. Медицинский работник формирует в МИС график (расписание) и слоты приема врачей",
          "item": [
            {
              "name": "Метод проверки наличия графика (расписания) за текущий месяц",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=ge2026-06-01&date=le2026-06-30",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "ge2026-06-01"
                    },
                    {
                      "key": "date",
                      "value": "le2026-06-30"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Импорт расписаний и слотов",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/OrganizationBundle\"\r\n        ]\r\n    },\r\n    \"type\": \"transaction\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Schedule/ScheduleTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Schedule\",\r\n                \"id\": \"ScheduleTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ScheduleBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    },\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"name\": \"Расписание работы врачей УЗ\",\r\n                \"actor\": [\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                    },\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                    }\r\n                ],\r\n                \"planningHorizon\": {\r\n                    \"start\": \"2026-06-01T00:00:00+00:00\",\r\n                    \"end\": \"2026-06-01T23:59:00+00:00\"\r\n                },\r\n                \"comment\": \"Расписание \"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest1\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest1\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SlotReserved\",\r\n                        \"valueBoolean\": true\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/ScheduleTest\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-01T08:00:00.000+00:00\",\r\n                \"end\": \"2026-06-01T08:30:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest2\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest2\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_neurologist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/ScheduleTest\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-01T08:30:00.000+00:00\",\r\n                \"end\": \"2026-06-01T09:00:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "2. Медицинский работник редактирует расписание + слоты",
          "item": [
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=2026-06-01",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "2026-06-01"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Редактирование расписания и слотов",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/OrganizationBundle\"\r\n        ]\r\n    },\r\n    \"type\": \"transaction\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Schedule/{{scheduleId}}\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Schedule\",\r\n                \"id\": \"{{scheduleId}}\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ScheduleBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C014.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    },\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\"\r\n                            }\r\n                        ]\r\n                    },\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C014\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"name\": \"Расписание работы врачей УЗ на 02.06.2026\",\r\n                \"actor\": [\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                    },\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                    }\r\n                ],\r\n                \"planningHorizon\": {\r\n                    \"start\": \"2026-06-02T00:00:00+00:00\",\r\n                    \"end\": \"2026-06-02T23:59:00+00:00\"\r\n                },\r\n                \"comment\": \"Редактирование расписания\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"PUT\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/{{slotId_1}}\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"{{slotId_1}}\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SlotReserved\",\r\n                        \"valueBoolean\": true\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/{{scheduleId}}\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-02T08:00:00.000+00:00\",\r\n                \"end\": \"2026-06-02T08:30:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"PUT\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/{{slotId_2}}\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"{{slotId_2}}\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_neurologist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/{{scheduleId}}\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-02T08:30:00.000+00:00\",\r\n                \"end\": \"2026-06-02T09:00:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"PUT\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение графика (расписания)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение отредактированных слотов",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "3. Медицинский работник редактирует только слоты",
          "item": [
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=2026-06-02",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "2026-06-02"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Редактирование слотов (создание новых)",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/OrganizationBundle\"\r\n        ]\r\n    },\r\n    \"type\": \"transaction\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest3\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest3\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/{{scheduleId}}\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-02T09:10:00.000+00:00\",\r\n                \"end\": \"2026-06-02T09:40:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest4\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest4\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SlotReserved\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/RequestFromOrganization\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/{{scheduleId}}\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-02T10:00:00.000+00:00\",\r\n                \"end\": \"2026-06-02T10:30:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение отредактированных слотов",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "4. Медицинский работник удаляет расписание",
          "item": [
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=2026-06-02",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "2026-06-02"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Удаление расписания",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/OrganizationBundle\"\r\n        ]\r\n    },\r\n    \"type\": \"transaction\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n         {\r\n            \"fullUrl\": \"Schedule/{{scheduleId}}\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Schedule\",\r\n                \"id\": \"{{scheduleId}}\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ScheduleBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/CancellationReason\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/VSServiceRequestRejectionReasonProvider\",\r\n                                    \"code\": \"maint.vs\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": false,\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.2\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C051.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C014.1\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C051\"\r\n                            }\r\n                        ]\r\n                    },\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\"\r\n                            }\r\n                        ]\r\n                    },\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C014\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"name\": \"Расписание работы врачей УЗ на 02.06.2026\",\r\n                \"actor\": [\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_therapist}}\"\r\n                    },\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                    }\r\n                ],\r\n                \"planningHorizon\": {\r\n                    \"start\": \"2026-06-02T00:00:00+00:00\",\r\n                    \"end\": \"2026-06-02T23:59:00+00:00\"\r\n                },\r\n                \"comment\": \"Расписание отменено по причине неотложных служебных задач или совещания\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"PUT\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule/{{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule",
                    "{{scheduleId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        }
      ]
    },
    {
      "name": "Запись на медицинские услуги из МИС",
      "item": [
        {
          "name": "Предварительные условия (Авторизация мед.работника, создание Расписания и Слотов)",
          "item": [
            {
              "name": "Достать врача и организацию из токена врача и добавить в переменную",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "const jwt = pm.request.auth.oauth2.get(\"accessToken\");\r",
                      "console.log(jwt);\r",
                      "if (jwt) {\r",
                      "    let payload = jwt.split('.')[1];\r",
                      "    payload = payload.replace(/-/g, '+').replace(/_/g, '/');\r",
                      "    while (payload.length % 4) payload += '=';\r",
                      "    let decoded = JSON.parse(atob(payload));\r",
                      "    console.log(decoded)\r",
                      "    let practitionerId = decoded.practitioner_id || decoded.practitionerId || decoded[\"practitioner_id\"];\r",
                      "    let organizationId = decoded.organization_id || decoded.organizationId || decoded[\"organization_id\"];\r",
                      "    if (practitionerId) pm.environment.set(\"PractitionerId\", practitionerId);\r",
                      "    if (organizationId) pm.environment.set(\"OrganizationId\", organizationId);\r",
                      "} else {\r",
                      "    console.log(\"JWT токен не найден в переменных коллекции\");\r",
                      "}"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "protocolProfileBehavior": {
                "disableBodyPruning": true
              },
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "0.3.4934",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "https://postman-echo.com/get",
                  "protocol": "https",
                  "host": [
                    "postman-echo",
                    "com"
                  ],
                  "path": [
                    "get"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Достать PractitionerRole врача (PractitionerRole)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let practitionerRole = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"PractitionerRole\", practitionerRole);\r",
                      "console.log(practitionerRole)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?practitioner={{PractitionerId}}&position-type=cardiac-surgeon",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "practitioner",
                      "value": "{{PractitionerId}}"
                    },
                    {
                      "key": "position-type",
                      "value": "cardiac-surgeon"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Достать структурное подразделение врача (LocationId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "let json = pm.response.json();\r",
                      "let locationValue = null;\r",
                      "\r",
                      "if (Array.isArray(json.entry)) {\r",
                      "    for (let entry of json.entry) {\r",
                      "        if (\r",
                      "            entry.resource &&\r",
                      "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                      "            Array.isArray(entry.resource.location) &&\r",
                      "            entry.resource.location.length > 0\r",
                      "        ) {\r",
                      "            // Берём reference первого location и извлекаем только UUID\r",
                      "            let ref = entry.resource.location[0].reference;\r",
                      "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                      "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                      "            }\r",
                      "            break;\r",
                      "        }\r",
                      "    }\r",
                      "}\r",
                      "\r",
                      "if (locationValue) {\r",
                      "    pm.environment.set(\"LocationId\", locationValue);\r",
                      "    console.log(\"location сохранён:\", locationValue);\r",
                      "} else {\r",
                      "    console.log(\"location не найден\");\r",
                      "}\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "_id",
                      "value": "{{PractitionerRole}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск PractitionerRole врача-педиатра",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let practitionerRole_pediatrician = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"PractitionerRole_pediatrician\", practitionerRole_pediatrician);\r",
                      "console.log(practitionerRole_pediatrician)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?position-type=pediatrician&organization={{OrganizationId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "position-type",
                      "value": "pediatrician"
                    },
                    {
                      "key": "organization",
                      "value": "{{OrganizationId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск Location врача-педиатра",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "let json = pm.response.json();\r",
                      "let locationValue = null;\r",
                      "\r",
                      "if (Array.isArray(json.entry)) {\r",
                      "    for (let entry of json.entry) {\r",
                      "        if (\r",
                      "            entry.resource &&\r",
                      "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                      "            Array.isArray(entry.resource.location) &&\r",
                      "            entry.resource.location.length > 0\r",
                      "        ) {\r",
                      "            // Берём reference первого location и извлекаем только UUID\r",
                      "            let ref = entry.resource.location[0].reference;\r",
                      "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                      "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                      "            }\r",
                      "            break;\r",
                      "        }\r",
                      "    }\r",
                      "}\r",
                      "\r",
                      "if (locationValue) {\r",
                      "    pm.environment.set(\"LocationId_pediatrician\", locationValue);\r",
                      "    console.log(\"location сохранён:\", locationValue);\r",
                      "} else {\r",
                      "    console.log(\"location не найден\");\r",
                      "}\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole_pediatrician}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "_id",
                      "value": "{{PractitionerRole_pediatrician}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск PractitionerRole врача-невролога",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let practitionerRole_neurologist = jsonData.entry.find(obj => obj.resource.resourceType === \"PractitionerRole\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"PractitionerRole_neurologist\", practitionerRole_neurologist);\r",
                      "console.log(practitionerRole_neurologist)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?position-type=neurologist&organization={{OrganizationId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "position-type",
                      "value": "neurologist"
                    },
                    {
                      "key": "organization",
                      "value": "{{OrganizationId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск Location врача-невролога",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "let json = pm.response.json();\r",
                      "let locationValue = null;\r",
                      "\r",
                      "if (Array.isArray(json.entry)) {\r",
                      "    for (let entry of json.entry) {\r",
                      "        if (\r",
                      "            entry.resource &&\r",
                      "            entry.resource.resourceType === \"PractitionerRole\" &&\r",
                      "            Array.isArray(entry.resource.location) &&\r",
                      "            entry.resource.location.length > 0\r",
                      "        ) {\r",
                      "            // Берём reference первого location и извлекаем только UUID\r",
                      "            let ref = entry.resource.location[0].reference;\r",
                      "            if (typeof ref === \"string\" && ref.startsWith(\"Location/\")) {\r",
                      "                locationValue = ref.split(\"/\")[1]; // или: ref.replace(\"Location/\", \"\")\r",
                      "            }\r",
                      "            break;\r",
                      "        }\r",
                      "    }\r",
                      "}\r",
                      "\r",
                      "if (locationValue) {\r",
                      "    pm.environment.set(\"LocationId_neurologist\", locationValue);\r",
                      "    console.log(\"location сохранён:\", locationValue);\r",
                      "} else {\r",
                      "    console.log(\"location не найден\");\r",
                      "}\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/PractitionerRole?_id={{PractitionerRole_neurologist}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "PractitionerRole"
                  ],
                  "query": [
                    {
                      "key": "_id",
                      "value": "{{PractitionerRole_neurologist}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Импорт расписаний и слотов",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"{{$guid}}\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/OrganizationBundle\"\r\n        ]\r\n    },\r\n    \"type\": \"transaction\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Schedule/ScheduleTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Schedule\",\r\n                \"id\": \"ScheduleTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ScheduleBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C035.2\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-педиатра участкового\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C035.1\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-педиатра\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-невролога\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C035\",\r\n                                \"display\": \"Педиатрия\"\r\n                            }\r\n                        ]\r\n                    },\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\",\r\n                                \"display\": \"Неврология\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"name\": \"Расписание работы врачей на 01.06.2026\",\r\n                \"actor\": [\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_pediatrician}}\"\r\n                    },\r\n                    {\r\n                        \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                    }\r\n                ],\r\n                \"planningHorizon\": {\r\n                    \"start\": \"2026-06-01T00:00:00+00:00\",\r\n                    \"end\": \"2026-06-01T23:59:00+00:00\"\r\n                },\r\n                \"comment\": \"Расписание работы врачей на 01.06.2026\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest1\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest1\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_pediatrician}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"paid\",\r\n                                    \"display\": \"Платные услуги\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PriceIfPaid\",\r\n                        \"valueQuantity\": {\r\n                            \"value\": 20,\r\n                            \"unit\": \"BYN\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": false\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_pediatrician}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C035.2\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-педиатра участкового\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C035.1\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-педиатра\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C035\",\r\n                                \"display\": \"Педиатрия\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\",\r\n                                \"display\": \"плановый первичный прием\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/ScheduleTest\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-01T08:00:00.000+00:00\",\r\n                \"end\": \"2026-06-01T08:30:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest2\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest2\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_pediatrician}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\",\r\n                                    \"display\": \"Бесплатные услуги\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_pediatrician}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C035.2\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-педиатра участкового\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C035.1\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-педиатра\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C035\",\r\n                                \"display\": \"Педиатрия\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\",\r\n                                \"display\": \"плановый первичный прием\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/ScheduleTest\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-01T08:30:00.000+00:00\",\r\n                \"end\": \"2026-06-01T09:00:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest3\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest3\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_neurologist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\",\r\n                                    \"display\": \"Бесплатные услуги\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": false\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-невролога\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\",\r\n                                \"display\": \"Неврология\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\",\r\n                                \"display\": \"плановый первичный прием\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/ScheduleTest\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-01T10:00:00.000+00:00\",\r\n                \"end\": \"2026-06-01T10:30:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Slot/SlotTest4\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Slot\",\r\n                \"id\": \"SlotTest4\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/SlotBy\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/OrganizationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/LocationReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Location/{{LocationId_neurologist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                                    \"code\": \"free\",\r\n                                    \"display\": \"Бесплатные услуги\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/WithServiceRequest\",\r\n                        \"valueBoolean\": true\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PractitionerRoleReference\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole_neurologist}}\"\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SlotReserved\",\r\n                        \"valueBoolean\": true\r\n                    }\r\n                ],\r\n                \"serviceCategory\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"serviceType\": [\r\n                    {\r\n                        \"concept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                    \"code\": \"C027.1\",\r\n                                    \"display\": \"Прием (осмотр, консультация) врача-невролога\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    }\r\n                ],\r\n                \"specialty\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                \"code\": \"C027\",\r\n                                \"display\": \"Неврология\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointmentType\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                                \"code\": \"routin\",\r\n                                \"display\": \"плановый первичный прием\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"schedule\": {\r\n                    \"reference\": \"Schedule/ScheduleTest\"\r\n                },\r\n                \"status\": \"free\",\r\n                \"start\": \"2026-06-01T11:00:00.000+00:00\",\r\n                \"end\": \"2026-06-01T11:30:00.000+00:00\"\r\n            },\r\n            \"request\": {\r\n                \"method\": \"POST\",\r\n                \"url\": \"https://pqms.cisz.by/SlotsApi/Fhir/Organization\"\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск пациента по идентификатору (patientId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"patientId\", patientId);\r",
                      "console.log(patientId)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient"
                  ],
                  "query": [
                    {
                      "key": "identifier:of-type",
                      "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Создание направления на консультацию",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      "const tokenUrl = \"https://staging.cisz.by/auth/api/realms/ppa/token\";\r",
                      "const clientId = \"pqms.portal.api\";\r",
                      "const clientSecret = \"pMrjtzx51UBNiJw1JHcdVutcVxmXKdFv\";\r",
                      "const grantType = \"client_credentials\";\r",
                      "\r",
                      "const postBody = {\r",
                      "    client_id: clientId,\r",
                      "    client_secret: clientSecret,\r",
                      "    grant_type: grantType\r",
                      "};\r",
                      "\r",
                      "pm.sendRequest({\r",
                      "    url: tokenUrl,\r",
                      "    method: \"POST\",\r",
                      "    header: {\r",
                      "        \"Content-Type\": \"application/x-www-form-urlencoded\"\r",
                      "    },\r",
                      "    body: {\r",
                      "        mode: \"urlencoded\",\r",
                      "        urlencoded: Object.entries(postBody).map(([key, value]) => ({\r",
                      "            key: key,\r",
                      "            value: value\r",
                      "        }))\r",
                      "    }\r",
                      "}, (err, response) => {\r",
                      "    if (err) {\r",
                      "        console.error(\"Ошибка при запросе токена:\", err);\r",
                      "        return;\r",
                      "    }\r",
                      "\r",
                      "    const responseData = response.json();\r",
                      "    if (responseData.access_token) {\r",
                      "        pm.environment.set(\"access_token\", responseData.access_token);\r",
                      "        console.log(\"Токен успешно сохранён в переменную access_token\");\r",
                      "    } else {\r",
                      "        console.error(\"Токен не получен. Ответ сервера:\", responseData);\r",
                      "    }\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"BundleSRConsult\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument\"\r\n        ]\r\n    },\r\n    \"identifier\": {\r\n        \"system\": \"https://fhir.by/ValueSet/urn:ietf:rfc:3086\",\r\n        \"value\": \"{{$guid}}\"\r\n    },\r\n    \"type\": \"document\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Composition/CompositionSRConsult\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Composition\",\r\n                \"id\": \"CompositionSRConsult\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/CompDocument\"\r\n                    ]\r\n                },\r\n                \"status\": \"final\",\r\n                \"type\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/CompositionType\",\r\n                            \"code\": \"general\",\r\n                            \"display\": \"Общая медицинская информация\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"date\": \"2026-06-01\",\r\n                \"encounter\": {\r\n                    \"reference\": \"Encounter/EncounterSRConsult\"\r\n                },\r\n                \"author\": [\r\n                    {\r\n                        \"reference\": \"Practitioner/{{PractitionerId}}\"\r\n                    }\r\n                ],\r\n                \"title\": \"CompDocument для наполненного Bundle по Направлению пациента на медицинскую услугу\",\r\n                \"custodian\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                },\r\n                \"event\": [\r\n                    {\r\n                        \"detail\": [\r\n                            {\r\n                                \"reference\": {\r\n                                    \"reference\": \"ServiceRequest/ExampleSRConsultPediatrician\"\r\n                                }\r\n                            },\r\n                            {\r\n                                \"reference\": {\r\n                                    \"reference\": \"ServiceRequest/ExampleSRConsultNeurologist\"\r\n                                }\r\n                            },\r\n                            {\r\n                                \"reference\": {\r\n                                    \"reference\": \"Condition/ConditionSRConsult\"\r\n                                }\r\n                            }\r\n                        ]\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Patient/PatientTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Patient\",\r\n                \"id\": \"PatientTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/PatientWithoutIdentificationNumber\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PatientBirthDateTime\",\r\n                        \"valueDateTime\": \"2020-05-15T20:12:00Z\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"use\": \"temp\",\r\n                        \"type\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/PersonalDocumentType\",\r\n                                    \"version\": \"1.324\",\r\n                                    \"code\": \"MCN\",\r\n                                    \"display\": \"Военный билет\"\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"value\": \"990330048\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\",\r\n                            \"display\": \"Открытое акционерное общество \\\"Агентство сервисизации и реинжиниринга\\\"\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"name\": [\r\n                    {\r\n                        \"family\": \"Федотов\",\r\n                        \"given\": [\r\n                            \"Марк\",\r\n                            \"Григорьевич\"\r\n                        ]\r\n                    }\r\n                ],\r\n                \"telecom\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"phone\",\r\n                        \"value\": \"+375295437513\"\r\n                    },\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"email\",\r\n                        \"value\": \"bychkovaa.dii+500@gmail.com\"\r\n                    }\r\n                ],\r\n                \"gender\": \"male\",\r\n                \"birthDate\": \"2020-05-15\",\r\n                \"deceasedBoolean\": false,\r\n                \"address\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/CoutryForAddresses\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/CitizenshipCode\",\r\n                                            \"version\": \"1.91\",\r\n                                            \"code\": \"BY\",\r\n                                            \"display\": \"Беларусь\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/StreetGeoRegistry\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/StreetGeoRegistry\",\r\n                                            \"version\": \"1.109\",\r\n                                            \"code\": \"72609920778\",\r\n                                            \"display\": \"Переулок Снежный\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/ApartmentRoom\",\r\n                                \"valueString\": \"кв. 11\"\r\n                            }\r\n                        ],\r\n                        \"use\": \"temp\",\r\n                        \"text\": \"Могилевская область, г. Могилев, Переулок Снежный\",\r\n                        \"line\": [\r\n                            \"Переулок Снежный\"\r\n                        ],\r\n                        \"city\": \"г. Могилев\",\r\n                        \"state\": \"Могилевская область\",\r\n                        \"country\": \"Беларусь\"\r\n                    }\r\n                ],\r\n                \"multipleBirthInteger\": 2\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Encounter/EncounterSRConsult\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Encounter\",\r\n                \"id\": \"EncounterSRConsult\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/EncounterGeneral\"\r\n                    ]\r\n                },\r\n                \"status\": \"completed\",\r\n                \"class\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/VSTermsOfService\",\r\n                                \"code\": \"1\",\r\n                                \"display\": \"амбулаторные\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/HealthCareForms\",\r\n                            \"code\": \"planned\",\r\n                            \"display\": \"Плановая медицинская помощь\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"type\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/TypeOfHealthCare\",\r\n                                \"code\": \"primary\",\r\n                                \"display\": \"Первичная медицинская помощь\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"serviceProvider\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                },\r\n                \"participant\": [\r\n                    {\r\n                        \"actor\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"actualPeriod\": {\r\n                    \"start\": \"2026-06-01T11:12:21Z\",\r\n                    \"end\": \"2026-06-01T11:22:21Z\"\r\n                },\r\n                \"admission\": {\r\n                    \"origin\": {\r\n                        \"reference\": \"Organization/{{OrganizationId}}\"\r\n                    }\r\n                },\r\n                \"diagnosis\": [\r\n                    {\r\n                        \"condition\": [\r\n                            {\r\n                                \"reference\": {\r\n                                    \"reference\": \"Condition/ConditionSRConsult\"\r\n                                }\r\n                            }\r\n                        ],\r\n                        \"use\": [\r\n                            {\r\n                                \"coding\": [\r\n                                    {\r\n                                        \"system\": \"https://fhir.by/ValueSet/TypeOfDiagnosis\",\r\n                                        \"code\": \"mainDiagnosis\",\r\n                                        \"display\": \"Основной диагноз\"\r\n                                    }\r\n                                ]\r\n                            }\r\n                        ]\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Condition/ConditionSRConsult\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Condition\",\r\n                \"id\": \"ConditionSRConsult\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/FinalDiagnosis\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/KindOfDiagnosis\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/KindOfDiagnosisCode\",\r\n                                    \"code\": \"Final\",\r\n                                    \"display\": \"Заключительный диагноз\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/AssertedDate\",\r\n                        \"valueDateTime\": \"2026-06-01\"\r\n                    }\r\n                ],\r\n                \"clinicalStatus\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\r\n                            \"code\": \"active\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"code\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/InternClassificDiseases10\",\r\n                            \"code\": \"M17.3\"\r\n                        }\r\n                    ],\r\n                    \"text\": \"M17.3 - Другие посттравматические гонартрозы\"\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"onsetDateTime\": \"2026-06-01\",\r\n                \"recordedDate\": \"2026-06-01\",\r\n                \"participant\": [\r\n                    {\r\n                        \"actor\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                        }\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n                {\r\n            \"fullUrl\": \"ServiceRequest/ExampleSRConsultPediatrician\",\r\n            \"resource\": {\r\n                \"resourceType\": \"ServiceRequest\",\r\n                \"id\": \"ExampleSRConsultPediatrician\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ServiceRequestConsult\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SpecialtyCode\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                    \"code\": \"C035\",\r\n                                    \"display\": \"Педиатрия\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/RequestFromOrganization\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"value\": \"01/1\"\r\n                    }\r\n                ],\r\n                \"status\": \"active\",\r\n                \"intent\": \"directive\",\r\n                \"category\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": \"routine\",\r\n                \"code\": {\r\n                    \"concept\": {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                \"code\": \"C035.2\",\r\n                                \"display\": \"Прием (осмотр, консультация) врача-педиатра\"\r\n                            }\r\n                        ]\r\n                    }\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"occurrenceDateTime\": \"2026-06-01T09:00:00Z\",\r\n                \"authoredOn\": \"2026-06-01T00:00:00Z\",\r\n                \"requester\": {\r\n                    \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                },\r\n                \"performer\": [\r\n                    {\r\n                        \"reference\": \"Organization/{{OrganizationId}}\"\r\n                    }\r\n                ],\r\n                \"encounter\": {\r\n                    \"reference\": \"Encounter/EncounterSRConsult\"\r\n                },\r\n                \"location\": [\r\n                    {\r\n                        \"reference\": {\r\n                            \"reference\": \"Location/{{LocationId_pediatrician}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"reason\": [\r\n                    {\r\n                        \"reference\": {\r\n                            \"reference\": \"Condition/ConditionSRConsult\"\r\n                        },\r\n                        \"concept\": {\r\n                            \"text\": \"консультация врача-педиатра\"\r\n                        }\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n                {\r\n            \"fullUrl\": \"ServiceRequest/ExampleSRConsultNeurologist\",\r\n            \"resource\": {\r\n                \"resourceType\": \"ServiceRequest\",\r\n                \"id\": \"ExampleSRConsultNeurologist\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/ServiceRequestConsult\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/SpecialtyCode\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                                    \"code\": \"C027\",\r\n                                    \"display\": \"Неврология\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/RequestFromOrganization\",\r\n                        \"valueReference\": {\r\n                            \"reference\": \"Organization/{{OrganizationId}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"value\": \"1345\"\r\n                    }\r\n                ],\r\n                \"status\": \"active\",\r\n                \"intent\": \"directive\",\r\n                \"category\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                                \"code\": \"03/3\",\r\n                                \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": \"routine\",\r\n                \"code\": {\r\n                    \"concept\": {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                                \"code\": \"C027.1\",\r\n                                \"display\": \"Прием (осмотр, консультация) врача-невролога\"\r\n                            }\r\n                        ]\r\n                    }\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"occurrenceDateTime\": \"2026-06-01T11:00:00Z\",\r\n                \"authoredOn\": \"2026-06-01T00:00:00Z\",\r\n                \"requester\": {\r\n                    \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                },\r\n                \"performer\": [\r\n                    {\r\n                        \"reference\": \"Organization/{{OrganizationId}}\"\r\n                    }\r\n                ],\r\n                \"encounter\": {\r\n                    \"reference\": \"Encounter/EncounterSRConsult\"\r\n                },\r\n                \"location\": [\r\n                    {\r\n                        \"reference\": {\r\n                            \"reference\": \"Location/{{LocationId_neurologist}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"reason\": [\r\n                    {\r\n                        \"reference\": {\r\n                            \"reference\": \"Condition/ConditionSRConsult\"\r\n                        },\r\n                        \"concept\": {\r\n                            \"text\": \"консультация врача-невролога\"\r\n                        }\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "1. Бронирование слотов без направления",
          "item": [
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=2026-06-01",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "2026-06-01"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение определенного слота",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&_id={{slotId_1}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "_id",
                      "value": "{{slotId_1}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск пациента по идентификатору (patientId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"patientId\", patientId);\r",
                      "console.log(patientId)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient"
                  ],
                  "query": [
                    {
                      "key": "identifier:of-type",
                      "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Бронирование слота без направления",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "jsonData = pm.response.json();\r",
                      "let appoinmentId = jsonData.entry.find(obj => obj.resource.resourceType === \"Appoitment\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"appointmentId\", appoinmentIdId);\r",
                      "console.log(appoinmentIdId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Appointment\",\r\n    \"id\": \"AppointmentTest\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/StructureDefinition/AppointmentBy\"\r\n        ]\r\n    },\r\n    \"extension\": [\r\n        {\r\n            \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n            \"valueCodeableConcept\": {\r\n                \"coding\": [\r\n                    {\r\n                        \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                        \"code\": \"paid\",\r\n                        \"display\": \"Платные услуги\"\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ],\r\n    \"identifier\": [\r\n        {\r\n            \"value\": \"A01\",\r\n            \"assigner\": {\r\n                \"reference\": \"Organization/{{OrganizationId}}\"\r\n            }\r\n        }\r\n    ],\r\n    \"status\": \"pending\",\r\n    \"serviceCategory\": [\r\n        {\r\n            \"coding\": [\r\n                {\r\n                    \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                    \"version\": \"1.72\",\r\n                    \"code\": \"03/3\",\r\n                    \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"serviceType\": [\r\n        {\r\n            \"concept\": {\r\n                \"coding\": [\r\n                    {\r\n                        \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                        \"code\": \"C035.1\",\r\n                        \"display\": \"Прием (осмотр, консультация) врача-педиатра\"\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ],\r\n    \"specialty\": [\r\n        {\r\n            \"coding\": [\r\n                {\r\n                    \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                    \"code\": \"C035\",\r\n                    \"display\": \"Педиатрия\"\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"appointmentType\": {\r\n        \"coding\": [\r\n            {\r\n                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                \"code\": \"routin\",\r\n                \"display\": \"плановый первичный прием\"\r\n            }\r\n        ]\r\n    },\r\n    \"reason\": [\r\n        {\r\n            \"concept\": {\r\n                \"text\": \"Боли в мышцах, которые беспокоят длительное время\"\r\n            }\r\n        }\r\n    ],\r\n    \"priority\": {\r\n        \"coding\": [\r\n            {\r\n                \"system\": \"https://fhir.by/ValueSet/HealthCareForms\",\r\n                \"code\": \"planned\",\r\n                \"display\": \"Плановая медицинская помощь\"\r\n            }\r\n        ]\r\n    },\r\n    \"start\": \"2026-06-01T08:00:00.000+00:00\",\r\n    \"end\": \"2026-06-01T08:30:00.000+00:00\",\r\n    \"slot\": [\r\n        {\r\n            \"reference\": \"Slot/{{slotId_1}}\"\r\n        }\r\n    ],\r\n    \"created\": \"2026-05-03T07:00:00Z\",\r\n    \"subject\": {\r\n        \"reference\": \"Patient/{{patientId}}\"\r\n    },\r\n    \"participant\": [\r\n        {\r\n            \"actor\": {\r\n                \"reference\": \"PractitionerRole/{{PractitionerRole_pediatrician}}\"\r\n            },\r\n            \"status\": \"accepted\"\r\n        },\r\n        {\r\n            \"actor\": {\r\n                \"reference\": \"Location/{{LocationId_pediatrician}}\"\r\n            },\r\n            \"status\": \"accepted\"\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Appointment",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Appointment"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "2. Отмена бронирования слотов",
          "item": [
            {
              "name": "Поиск пациента по идентификатору (patientId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"patientId\", patientId);\r",
                      "console.log(patientId)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient"
                  ],
                  "query": [
                    {
                      "key": "identifier:of-type",
                      "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение информации бронировании в контексте пациента",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let appointmentId = jsonData.entry.find(obj => obj.resource.resourceType === \"Appointment\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"appointmentId\", appointmentId);\r",
                      "console.log(appointmentId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/Appointment?_profile=https://fhir.by/StructureDefinition/AppointmentBy&_sort=-_lastUpdated&status=booked",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient",
                    "{{patientId}}",
                    "Appointment"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/AppointmentBy"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "status",
                      "value": "booked"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Отмена бронирования слота",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n  \"resourceType\": \"Parameters\",\r\n  \"parameter\": [\r\n    {\r\n      \"name\": \"cancellation-reason\",\r\n      \"valueCoding\": {\r\n        \"system\": \"https://fhir.by/ValueSet/appointmentCancelationReason\",\r\n        \"code\": \"pat-cpp\"\r\n      }\r\n    },\r\n    {\r\n      \"name\": \"notes\",\r\n      \"valueString\": \"улучшение состояния\"\r\n    }\r\n  ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/Appointment/{{appointmentId}}/$cancel",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient",
                    "{{patientId}}",
                    "Appointment",
                    "{{appointmentId}}",
                    "$cancel"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение информации бронировании в контексте пациента",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/Appointment?_profile=https://fhir.by/StructureDefinition/AppointmentBy&_sort=-_lastUpdated&status=booked",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient",
                    "{{patientId}}",
                    "Appointment"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/AppointmentBy"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "status",
                      "value": "booked"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "3. Бронирование слотов с направлением",
          "item": [
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=2026-06-01",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "2026-06-01"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение определенного слота",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&_id={{slotId_2}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "_id",
                      "value": "{{slotId_2}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск активных  Направлений на медицинские услуги",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let serviceRequestId_pediatrician = jsonData.entry.find(obj => obj.resource.resourceType === \"ServiceRequest\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"serviceRequestId_pediatrician\", serviceRequestId_pediatrician);\r",
                      "console.log(serviceRequestId_pediatrician)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/ServiceRequest?_profile=https://fhir.by/StructureDefinition/ServiceRequestConsult&status=active&_sort=-_lastUpdated&code-concept=C035.2",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "ServiceRequest"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ServiceRequestConsult"
                    },
                    {
                      "key": "status",
                      "value": "active"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "code-concept",
                      "value": "C035.2"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск пациента по идентификатору (patientId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"patientId\", patientId);\r",
                      "console.log(patientId)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient"
                  ],
                  "query": [
                    {
                      "key": "identifier:of-type",
                      "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Бронирование слота с направлением",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "0.2.6503",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Appointment\",\r\n    \"id\": \"AppointmentTest2\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/StructureDefinition/AppointmentBy\"\r\n        ]\r\n    },\r\n    \"extension\": [\r\n        {\r\n            \"url\": \"https://fhir.by/StructureDefinition/PaidSlot\",\r\n            \"valueCodeableConcept\": {\r\n                \"coding\": [\r\n                    {\r\n                        \"system\": \"https://fhir.by/ValueSet/EncounterTypeOfService\",\r\n                        \"code\": \"free\",\r\n                        \"display\": \"Бесплатные услуги\"\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"url\": \"https://fhir.by/StructureDefinition/ServiceRequestAppointed\",\r\n            \"valueReference\": {\r\n                \"reference\": \"ServiceRequest/{{serviceRequestId_pediatrician}}\"\r\n            }\r\n        }\r\n    ],\r\n    \"identifier\": [\r\n        {\r\n            \"value\": \"A02\",\r\n            \"assigner\": {\r\n                \"reference\": \"Organization/{{OrganizationId}}\"\r\n            }\r\n        }\r\n    ],\r\n    \"status\": \"pending\",\r\n    \"serviceCategory\": [\r\n        {\r\n            \"coding\": [\r\n                {\r\n                    \"system\": \"https://fhir.by/ValueSet/HealthcareServiceCategory\",\r\n                    \"version\": \"1.72\",\r\n                    \"code\": \"03/3\",\r\n                    \"display\": \"Амбулаторно-поликлиническая диагностика для детского населения\"\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"serviceType\": [\r\n        {\r\n            \"concept\": {\r\n                \"coding\": [\r\n                    {\r\n                        \"system\": \"https://fhir.by/ValueSet/MedicalServiceType\",\r\n                        \"code\": \"C035.2\",\r\n                        \"display\": \"Прием (осмотр, консультация) врача-педиатра\"\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ],\r\n    \"specialty\": [\r\n        {\r\n            \"coding\": [\r\n                {\r\n                    \"system\": \"https://fhir.by/ValueSet/ServiceSpecialtyBy\",\r\n                    \"code\": \"C035\",\r\n                    \"display\": \"Педиатрия\"\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"appointmentType\": {\r\n        \"coding\": [\r\n            {\r\n                \"system\": \"https://fhir.by/ValueSet/SlotAppointmentTypeBy\",\r\n                \"code\": \"routin\",\r\n                \"display\": \"плановый первичный прием\"\r\n            }\r\n        ]\r\n    },\r\n    \"reason\": [\r\n        {\r\n            \"concept\": {\r\n                \"text\": \"Боли в мышцах, которые беспокоят длительное время\"\r\n            }\r\n        }\r\n    ],\r\n    \"priority\": {\r\n        \"coding\": [\r\n            {\r\n                \"system\": \"https://fhir.by/ValueSet/HealthCareForms\",\r\n                \"code\": \"planned\",\r\n                \"display\": \"Плановая медицинская помощь\"\r\n            }\r\n        ]\r\n    },\r\n    \"start\": \"2026-06-01T08:30:00.000+00:00\",\r\n    \"end\": \"2026-06-01T09:00:00.000+00:00\",\r\n    \"slot\": [\r\n        {\r\n            \"reference\": \"Slot/{{slotId_2}}\"\r\n        }\r\n    ],\r\n    \"created\": \"2026-05-30T08:15:00Z\",\r\n    \"subject\": {\r\n        \"reference\": \"Patient/{{patientId}}\"\r\n    },\r\n    \"participant\": [\r\n        {\r\n            \"actor\": {\r\n                \"reference\": \"PractitionerRole/{{PractitionerRole_pediatrician}}\"\r\n            },\r\n            \"status\": \"accepted\"\r\n        },\r\n        {\r\n            \"actor\": {\r\n                \"reference\": \"Location/{{LocationId_pediatrician}}\"\r\n            },\r\n            \"status\": \"accepted\"\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Appointment",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Appointment"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "4. Оказание услуги с формированием Encounter",
          "item": [
            {
              "name": "Получение расписаний в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let scheduleId = jsonData.entry.find(obj => obj.resource.resourceType === \"Schedule\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"scheduleId\", scheduleId);\r",
                      "console.log(scheduleId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Schedule?_profile=https://fhir.by/StructureDefinition/ScheduleBy&active=true&_sort=-_lastUpdated&date=2026-06-01",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Schedule"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/ScheduleBy"
                    },
                    {
                      "key": "active",
                      "value": "true"
                    },
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "date",
                      "value": "2026-06-01"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение слотов в контексте организации",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let slotId = jsonData.entry.find(obj => obj.resource.resourceType === \"Slot\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"slotId\", slotId);\r",
                      "console.log(slotId)\r",
                      "\r",
                      "const response = pm.response.json();\r",
                      "const ids = response.entry.map(entry => entry.resource.id).forEach((e,i)=>{\r",
                      "        pm.environment.set(`slotId_${i}`,e)\r",
                      "});"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Organization/{{OrganizationId}}/Slot?_profile=https://fhir.by/StructureDefinition/SlotBy&status=free&schedule={{scheduleId}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Organization",
                    "{{OrganizationId}}",
                    "Slot"
                  ],
                  "query": [
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/SlotBy"
                    },
                    {
                      "key": "status",
                      "value": "free"
                    },
                    {
                      "key": "schedule",
                      "value": "{{scheduleId}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Поиск пациента по идентификатору (patientId)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "var jsonData = pm.response.json();\r",
                      "let patientId = jsonData.entry.find(obj => obj.resource.resourceType === \"Patient\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"patientId\", patientId);\r",
                      "console.log(patientId)\r",
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient?identifier:of-type=https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient"
                  ],
                  "query": [
                    {
                      "key": "identifier:of-type",
                      "value": "https://fhir.by/ValueSet/PersonalDocumentType|MCN|990330048"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Получение информации бронировании в контексте пациента",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "jsonData = pm.response.json();\r",
                      "let appointmentId = jsonData.entry.find(obj => obj.resource.resourceType === \"Appointment\").resource.id;\r",
                      "\r",
                      "pm.environment.set(\"appointmentId\", appointmentId);\r",
                      "console.log(appointmentId)"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Patient/{{patientId}}/Appointment?_sort=-_lastUpdated&_profile=https://fhir.by/StructureDefinition/AppointmentBy&status=booked&slot={{slotId_1}}",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Patient",
                    "{{patientId}}",
                    "Appointment"
                  ],
                  "query": [
                    {
                      "key": "_sort",
                      "value": "-_lastUpdated"
                    },
                    {
                      "key": "_profile",
                      "value": "https://fhir.by/StructureDefinition/AppointmentBy"
                    },
                    {
                      "key": "status",
                      "value": "booked"
                    },
                    {
                      "key": "slot",
                      "value": "{{slotId_1}}"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Импорт EncounterGeneral",
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test(\"Валидный бандл должен отработать со статусом 202\", function () {\r",
                      "    pm.response.to.have.status(202);\r",
                      "});\r",
                      "\r",
                      "var jsonData = pm.response.json();\r",
                      "let bundleId = jsonData.parameter.find(obj => obj.name === \"ResourceId\").valueString;\r",
                      "let statusReference = jsonData.parameter.find(obj => obj.name === \"OperationStatusReference\");\r",
                      "\r",
                      "console.log(statusReference.valueReference.reference);\r",
                      "\r",
                      "pm.collectionVariables.set(\"bundleId\", bundleId);\r",
                      "pm.collectionVariables.set(\"StatusUrl\", statusReference.valueReference.reference);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "X-Fhir-By-Version",
                    "value": "active",
                    "type": "text"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\r\n    \"resourceType\": \"Bundle\",\r\n    \"id\": \"BundleSRConsult\",\r\n    \"meta\": {\r\n        \"profile\": [\r\n            \"https://fhir.by/AbstractArea/StructureDefinition/Bundle/MedicationDocument\"\r\n        ]\r\n    },\r\n    \"identifier\": {\r\n        \"system\": \"https://fhir.by/ValueSet/urn:ietf:rfc:3086\",\r\n        \"value\": \"{{$guid}}\"\r\n    },\r\n    \"type\": \"document\",\r\n    \"timestamp\": \"{{$isoTimestamp}}\",\r\n    \"entry\": [\r\n        {\r\n            \"fullUrl\": \"Composition/CompositionSRConsult\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Composition\",\r\n                \"id\": \"CompositionSRConsult\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/CompDocument\"\r\n                    ]\r\n                },\r\n                \"status\": \"final\",\r\n                \"type\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/CompositionType\",\r\n                            \"code\": \"general\",\r\n                            \"display\": \"Общая медицинская информация\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"subject\": [\r\n                    {\r\n                        \"reference\": \"Patient/PatientTest\"\r\n                    }\r\n                ],\r\n                \"date\": \"2026-06-03\",\r\n                \"encounter\": {\r\n                    \"reference\": \"Encounter/EncounterSRConsult\"\r\n                },\r\n                \"author\": [\r\n                    {\r\n                        \"reference\": \"Practitioner/{{PractitionerId}}\"\r\n                    }\r\n                ],\r\n                \"title\": \"CompDocument для наполненного Bundle по Направлению пациента на медицинскую услугу\",\r\n                \"custodian\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Patient/PatientTest\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Patient\",\r\n                \"id\": \"PatientTest\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/PatientWithoutIdentificationNumber\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/PatientBirthDateTime\",\r\n                        \"valueDateTime\": \"2020-05-15T20:12:00Z\"\r\n                    }\r\n                ],\r\n                \"identifier\": [\r\n                    {\r\n                        \"use\": \"temp\",\r\n                        \"type\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/PersonalDocumentType\",\r\n                                    \"version\": \"1.324\",\r\n                                    \"code\": \"MCN\",\r\n                                    \"display\": \"Военный билет\"\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"value\": \"990330048\",\r\n                        \"assigner\": {\r\n                            \"reference\": \"Organization/14736518-cc34-4e2e-8d60-204955589577\",\r\n                            \"display\": \"Открытое акционерное общество \\\"Агентство сервисизации и реинжиниринга\\\"\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"active\": true,\r\n                \"name\": [\r\n                    {\r\n                        \"family\": \"Федотов\",\r\n                        \"given\": [\r\n                            \"Марк\",\r\n                            \"Григорьевич\"\r\n                        ]\r\n                    }\r\n                ],\r\n                \"telecom\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"phone\",\r\n                        \"value\": \"+375295437513\"\r\n                    },\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"extension\": [\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientAccountPoint\",\r\n                                        \"valueBoolean\": true\r\n                                    },\r\n                                    {\r\n                                        \"url\": \"https://fhir.by/StructureDefinition/PatientConsentForNotification\",\r\n                                        \"valueBoolean\": true\r\n                                    }\r\n                                ],\r\n                                \"url\": \"https://fhir.by/StructureDefinition/PatientTelecomPurpose\"\r\n                            }\r\n                        ],\r\n                        \"system\": \"email\",\r\n                        \"value\": \"bychkovaa.dii+500@gmail.com\"\r\n                    }\r\n                ],\r\n                \"gender\": \"male\",\r\n                \"birthDate\": \"2020-05-15\",\r\n                \"deceasedBoolean\": false,\r\n                \"address\": [\r\n                    {\r\n                        \"extension\": [\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/CoutryForAddresses\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/CitizenshipCode\",\r\n                                            \"version\": \"1.91\",\r\n                                            \"code\": \"BY\",\r\n                                            \"display\": \"Беларусь\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/StreetGeoRegistry\",\r\n                                \"valueCodeableConcept\": {\r\n                                    \"coding\": [\r\n                                        {\r\n                                            \"system\": \"https://fhir.by/ValueSet/StreetGeoRegistry\",\r\n                                            \"version\": \"1.109\",\r\n                                            \"code\": \"72609920778\",\r\n                                            \"display\": \"Переулок Снежный\"\r\n                                        }\r\n                                    ]\r\n                                }\r\n                            },\r\n                            {\r\n                                \"url\": \"https://fhir.by/StructureDefinition/ApartmentRoom\",\r\n                                \"valueString\": \"кв. 11\"\r\n                            }\r\n                        ],\r\n                        \"use\": \"temp\",\r\n                        \"text\": \"Могилевская область, г. Могилев, Переулок Снежный\",\r\n                        \"line\": [\r\n                            \"Переулок Снежный\"\r\n                        ],\r\n                        \"city\": \"г. Могилев\",\r\n                        \"state\": \"Могилевская область\",\r\n                        \"country\": \"Беларусь\"\r\n                    }\r\n                ],\r\n                \"multipleBirthInteger\": 2\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Encounter/EncounterSRConsult\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Encounter\",\r\n                \"id\": \"EncounterSRConsult\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/EncounterGeneral\"\r\n                    ]\r\n                },\r\n                \"status\": \"completed\",\r\n                \"class\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/VSTermsOfService\",\r\n                                \"code\": \"1\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"priority\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/HealthCareForms\",\r\n                            \"code\": \"planned\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"type\": [\r\n                    {\r\n                        \"coding\": [\r\n                            {\r\n                                \"system\": \"https://fhir.by/ValueSet/TypeOfHealthCare\",\r\n                                \"code\": \"primary\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"serviceProvider\": {\r\n                    \"reference\": \"Organization/{{OrganizationId}}\"\r\n                },\r\n                \"participant\": [\r\n                    {\r\n                        \"actor\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                        }\r\n                    }\r\n                ],\r\n                \"actualPeriod\": {\r\n                    \"start\": \"2026-06-01T08:30:21Z\",\r\n                    \"end\": \"2026-06-01T08:52:21Z\"\r\n                },\r\n                \"admission\": {\r\n                    \"origin\": {\r\n                        \"reference\": \"Organization/{{OrganizationId}}\"\r\n                    }\r\n                },\r\n                \"diagnosis\": [\r\n                    {\r\n                        \"condition\": [\r\n                            {\r\n                                \"reference\": {\r\n                                    \"reference\": \"Condition/ConditionSRConsult\"\r\n                                }\r\n                            }\r\n                        ],\r\n                        \"use\": [\r\n                            {\r\n                                \"coding\": [\r\n                                    {\r\n                                        \"system\": \"https://fhir.by/ValueSet/TypeOfDiagnosis\",\r\n                                        \"code\": \"mainDiagnosis\"\r\n                                    }\r\n                                ]\r\n                            }\r\n                        ]\r\n                    }\r\n                ],\r\n                \"appointment\": [\r\n                    {\r\n                        \"reference\": \"Appointment/{{appointmentId}}\"\r\n                    }\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"fullUrl\": \"Condition/ConditionSRConsult\",\r\n            \"resource\": {\r\n                \"resourceType\": \"Condition\",\r\n                \"id\": \"ConditionSRConsult\",\r\n                \"meta\": {\r\n                    \"profile\": [\r\n                        \"https://fhir.by/StructureDefinition/FinalDiagnosis\"\r\n                    ]\r\n                },\r\n                \"extension\": [\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/KindOfDiagnosis\",\r\n                        \"valueCodeableConcept\": {\r\n                            \"coding\": [\r\n                                {\r\n                                    \"system\": \"https://fhir.by/ValueSet/KindOfDiagnosisCode\",\r\n                                    \"code\": \"Final\"\r\n                                }\r\n                            ]\r\n                        }\r\n                    },\r\n                    {\r\n                        \"url\": \"https://fhir.by/StructureDefinition/AssertedDate\",\r\n                        \"valueDateTime\": \"2026-06-01\"\r\n                    }\r\n                ],\r\n                \"clinicalStatus\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\r\n                            \"code\": \"active\"\r\n                        }\r\n                    ]\r\n                },\r\n                \"code\": {\r\n                    \"coding\": [\r\n                        {\r\n                            \"system\": \"https://fhir.by/ValueSet/InternClassificDiseases10\",\r\n                            \"code\": \"M17.3\"\r\n                        }\r\n                    ],\r\n                    \"text\": \"M17.3 - Другие посттравматические гонартрозы\"\r\n                },\r\n                \"subject\": {\r\n                    \"reference\": \"Patient/PatientTest\"\r\n                },\r\n                \"onsetDateTime\": \"2026-06-01\",\r\n                \"recordedDate\": \"2026-06-01\",\r\n                \"participant\": [\r\n                    {\r\n                        \"actor\": {\r\n                            \"reference\": \"PractitionerRole/{{PractitionerRole}}\"\r\n                        }\r\n                    }\r\n                ]\r\n            }\r\n        }\r\n    ]\r\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/$import",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "$import"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Метод получения статуса импорта пакета медицинской информации",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
                  "protocol": "{{Schema}}",
                  "host": [
                    "{{Proxy-host}}"
                  ],
                  "path": [
                    "fhir",
                    "Bundle",
                    "{{bundleId}}",
                    "$status"
                  ]
                }
              },
              "response": []
            }
          ]
        }
      ]
    },
    {
      "name": "Отмена импорта медицинской информации",
      "item": [
        {
          "name": "Отмена импорта медицинской информации",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$cancel",
              "protocol": "{{Schema}}",
              "host": [
                "{{Proxy-host}}"
              ],
              "path": [
                "fhir",
                "Bundle",
                "{{bundleId}}",
                "$cancel"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Получение статуса импорта пакета медицинской информации",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{Schema}}://{{Proxy-host}}/fhir/Bundle/{{bundleId}}/$status",
              "protocol": "{{Schema}}",
              "host": [
                "{{Proxy-host}}"
              ],
              "path": [
                "fhir",
                "Bundle",
                "{{bundleId}}",
                "$status"
              ]
            }
          },
          "response": []
        }
      ]
    }
  ],
  "auth": {
    "type": "oauth2",
    "oauth2": [
      {
        "key": "clientSecret",
        "value": "",
        "type": "string"
      },
      {
        "key": "clientId",
        "value": "iehr.swagger.client",
        "type": "string"
      },
      {
        "key": "grant_type",
        "value": "authorization_code_with_pkce",
        "type": "string"
      },
      {
        "key": "scope",
        "value": "client_organization",
        "type": "string"
      },
      {
        "key": "refreshRequestParams",
        "value": [],
        "type": "any"
      },
      {
        "key": "tokenRequestParams",
        "value": [
          {
            "key": "origin",
            "value": "https://oauth.pstmn.io/v1/callback",
            "enabled": true,
            "send_as": "request_header"
          }
        ],
        "type": "any"
      },
      {
        "key": "authRequestParams",
        "value": [],
        "type": "any"
      },
      {
        "key": "tokenName",
        "value": "test1",
        "type": "string"
      },
      {
        "key": "challengeAlgorithm",
        "value": "S256",
        "type": "string"
      },
      {
        "key": "useBrowser",
        "value": true,
        "type": "boolean"
      },
      {
        "key": "authUrl",
        "value": "https://staging.cisz.by/auth/api/realms/iehr/auth",
        "type": "string"
      },
      {
        "key": "addTokenTo",
        "value": "header",
        "type": "string"
      },
      {
        "key": "client_authentication",
        "value": "body",
        "type": "string"
      },
      {
        "key": "accessTokenUrl",
        "value": "https://staging.cisz.by/auth/api/realms/iehr/token",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "practitioner_id",
      "value": ""
    },
    {
      "key": "organization_id",
      "value": ""
    },
    {
      "key": "locationId",
      "value": ""
    },
    {
      "key": "patientId",
      "value": ""
    },
    {
      "key": "bundleId",
      "value": ""
    },
    {
      "key": "StatusUrl",
      "value": ""
    },
    {
      "key": "currentTimestamp",
      "value": ""
    }
  ]
}